package sim.tests.games.snake;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.math.Vector2;

import sim.tests.games.snake.SnakeGame.CompassDirection;

public class SnakeHead extends SnakePart
{
	long aftTime;
	long preTime = 0;
	boolean moving = false;
	

	public SnakeHead(float x, float y)
	{
		super(x, y);
		aftTime = System.currentTimeMillis();
	}

	

	@Override
	public void update(float timeStep)
	{
		
			//moving = true;
			//SnakeGame.grid[(int) pos.y][(int) pos.x] = null;
			//pos.add(direction);
			//SnakeGame.grid[(int) pos.y][(int) pos.x] = this;
			//moving = false;
		

		super.update(timeStep);
	}
	
	/**
	 * Sets heading according to user input.
	 */
	public void setHeading()
	{
		if (Gdx.input.isKeyPressed(Input.Keys.W))
			move(CompassDirection.North);
		else if (Gdx.input.isKeyPressed(Input.Keys.D))
			move(CompassDirection.East);
		else if (Gdx.input.isKeyPressed(Input.Keys.S))
			move(CompassDirection.South);
		else if (Gdx.input.isKeyPressed(Input.Keys.A))
			move(CompassDirection.West);
	}

}
